package com.base.service.impl;

import java.math.BigDecimal;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.base.mapper.voipmapper.FreeroutesMapper;
import com.base.po.sqlparam.FreeroutesExamplePage;
import com.base.po.voip.Freeroutes;
import com.base.po.voip.FreeroutesExample;
import com.base.service.FreeroutesService;
import com.base.utils.Produce;
import org.springframework.stereotype.Service;

@Service("freeroutesService")
public class FreeroutesServiceImpl implements FreeroutesService {
	@Autowired
	FreeroutesMapper freeroutesMapper;

	@Override
	public int countByExample(FreeroutesExample example) {
		return freeroutesMapper.countByExample(example);
	}

	@Override
	public int deleteByExample(FreeroutesExample example) {
		return freeroutesMapper.deleteByExample(example);
	}

	@Override
	public int deleteByPrimaryKey(String id) {
		if (id == null) {
			return 0;
		}
		return freeroutesMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(String name, BigDecimal feelroute, Boolean datastatus, Integer ratelength) {
		Freeroutes record = new Freeroutes(Produce.getUUID(), name, feelroute, datastatus, ratelength,
				Produce.getNowDate());
		return freeroutesMapper.insert(record);
	}

	@Override
	public int insertSelective(Freeroutes record) {
		return freeroutesMapper.insertSelective(record);
	}

	@Override
	public List<Freeroutes> selectByExample(FreeroutesExample example) {
		return freeroutesMapper.selectByExample(example);
	}

	@Override
	public List<Freeroutes> selectByExamplePage(FreeroutesExamplePage example) {
		return freeroutesMapper.selectByExamplePage(example);
	}

	@Override
	public Freeroutes selectByPrimaryKey(String id) {
		if (id == null) {
			return null;
		}
		return freeroutesMapper.selectByPrimaryKey(id);
	}

	@Override
	public int updateByExampleSelective(Freeroutes record, FreeroutesExample example) {
		return freeroutesMapper.updateByExampleSelective(record, example);
	}

	@Override
	public int updateByExample(Freeroutes record, FreeroutesExample example) {
		if (record == null) {
			return 0;
		}
		if (record.getId() == null) {
			return 0;
		}
		return freeroutesMapper.updateByExample(record, example);
	}

	@Override
	public int updateByPrimaryKeySelective(Freeroutes record) {
		if (record == null) {
			return 0;
		}
		if (record.getId() == null) {
			return 0;
		}
		return freeroutesMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(Freeroutes record) {
		if (record == null) {
			return 0;
		}
		if (record.getId() == null) {
			return 0;
		}
		return freeroutesMapper.updateByPrimaryKey(record);
	}

	@Override
	public List<Freeroutes> selectByAll() {
		
		return freeroutesMapper.selectByAll();
	}

}
